package leetcode;

public class LC2269 {

    public static int divisorSubstrings(int num, int k) {

        String numStr = new Integer(num).toString();
        int cnt = 0;

        for (int i = 0; i <= numStr.length() - k; i++) {
            Integer tmp = new Integer(numStr.substring(i,i+k));
            if (tmp != 0 && num % tmp == 0)
                cnt ++;
        }
        return cnt;
    }

    public static void main(String[] args) {
        System.out.println(divisorSubstrings(240,2));
    }

}
